
import { defineStore } from 'pinia';
import store from '@/store';
import { getAssetsFile } from "@/utils/index";

export const useAppStore = defineStore({
    id: 'app',
    state: () => ({
        currentModel: 'message',
        modelList: [{
            id: "message",
            name: "消息",
            // name: "1",
            icon: getAssetsFile("down.svg"),
            path: '/'
        },
        {
            id: "contract",
            name: "通讯录",
            // name: "2",
            icon: getAssetsFile("down.svg"),
            path: '/contract'
        },
        {
            id: "feature",
            name: "发现",
            // name: "3",
            icon: getAssetsFile("down.svg"),
            path: '/feature'
        },
        {
            id: "mine",
            name: "我的",
            // name: "4",
            icon: getAssetsFile("down.svg"),
            path: '/mine'
        },],
        appConfigValue: {
            sourceType: "",
            logoutMsg: "登录态失效，请重新登录",
            primaryColor: "#2A64F6",
            gradientColor: "linear-gradient(135deg, #5594ff 0%, #002cff 100%)",
            btnHoverColor: "#548aff",
            hoverColor: "#EDF3FE",
            waitColor: "#89bbf9",
            initTitle: "您好，我是AI智能助手 小普。我能为您提供专业的医疗器械相关咨询。快来试试吧~",
            // bpaiAvatarUrl: "https://psy-public.obs.myhuaweicloud.com/bpai/agent/bpaiAvatar.png",
            bpaiAvatarUrl: "https://psy-public.obs.myhuaweicloud.com/bpai/agent/userAvatar.png",
            userAvatarUrl: "https://psy-public.obs.myhuaweicloud.com/bpai/agent/userAvatar.png",
            titleIconUrl: "https://psy-public.obs.myhuaweicloud.com/bpai/agent/titleIcon.png",
        }
    }),
    getters: {
        getPageLoading(state) {
            return state.pageLoading;
        },

    },
    actions: {
        setModelList(list) {
            this.pageLoading = list;
        },
        setCurrentModel(model) {
            this.currentModel = model;
        },


    },
    persist: {
        enabled: true // true 表示开启持久化保存
    }
});

// Need to be used outside the setup
export function useAppStoreWithOut() {
    return useAppStore(store);
}
